<?php

namespace App;

class OrderAction extends OrderBase
{
    protected $guarded = [];
    protected $casts = [
        'details' => 'array'
    ];
    public function order()
    {
        return $this->belongsTo('App\Order');
    }

    public function user()
    {
        return $this->belongsTo('App\User');
    }

    public static function newAction(Order $order, $data=[])
    {
        $data = array_merge($data, ['order_id' => $order->id, 'order_status' => $order->order_status, 'shipping_status' => $order->shipping_status, 'pay_status' => $order->pay_status]);
        self::create($data);
    }
}
